package daos;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.Query;

import model.entities.Cliente;
import model.entities.Produto;

public class ClienteDAO extends AbstractDAO<Cliente> {

	public ClienteDAO(EntityManager manager) {
		super(manager);
	}
	
	public Class<Cliente> entityClass() {
		return Cliente.class;
	}
	
	public List<Cliente> listarClientePorNome(String nome){
		Query query = manager.createQuery("select c from Cliente c where c.nome Like :nome");
		query.setParameter("nome", "%"+nome+"%");
		return query.getResultList();
	}
	
	public List<Cliente> listarTodosClientes(){
		Query query = manager.createQuery("select c from Cliente c");
		return query.getResultList();
	}

}
